package com.sdry.reportforms.controller;

import com.sdry.basic.entity.AttendanceRecordDaySummary;
import com.sdry.common.BaseController;
import com.sdry.common.TableDataInfo;
import com.sdry.reportforms.service.ReportFormService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName ReportFormsController
 * @Descreption 报表
 * @Author lianleiming
 * @Date 2020-03-3115:32
 * @Version 1.0
 **/
@Controller
@RequestMapping("reportForms")
public class ReportFormsController extends BaseController {

    @Resource
    ReportFormService reportFormService;

    /**
     * 每日考勤汇总(人工调用日汇总方法)
     * @return
     */
    @RequestMapping(value = "/dailyAttendanceSummary")
    @ResponseBody
    public String dailyAttendanceSummary() {
        reportFormService.dailyAttendanceSummary();
        return "success";
    }

    /**
     * 进考勤月汇总表页面
     * @return
     */
    @RequestMapping(value = "/monthlySummaryOfAttendance")
    public String showMonthlyStatement() {
        return "/reportforms/monthlySummaryOfAttendance";
    }

    /**
     * 进考勤日记录表页面
     * @return
     */

    @RequestMapping(value = "/attendanceDayRecord")
    public String showDaliyStatement(){
        return "/reportforms/attendanceDayRecord";
    }

    /**
     * 分页查询考勤日记录表
     * @return
     */
    @ApiOperation(value = "获取考勤日记录列表",notes = "分页查询")
    @ApiImplicitParam(name = "showDailyStatement",value = "考勤实体AttendanceRecordDaySummary",required = true,dataType = "AttendanceRecordDaySummary")
    @RequestMapping(value = "/queryDailyStatement",method = RequestMethod.GET)
    @ResponseBody
    public TableDataInfo queryDailyStatement(AttendanceRecordDaySummary ards) {
        logger.info("获取考勤日记录列表 AttendanceRecordDaySummary = " + JSONObject.fromObject(ards));
        List<AttendanceRecordDaySummary> list = reportFormService.queryDailyStatement(ards);
        Long count = reportFormService.countDailyStatement(ards);
        return getDataTable(list, count);
    }

    /**
     * 分页查询考勤月汇总记录
     * @return
     */
    @ApiOperation(value = "分页查询考勤月汇总记录",notes = "分页查询")
    @ApiImplicitParam(name = "showDailyStatement",value = "考勤实体AttendanceRecordDaySummary",required = true,dataType = "AttendanceRecordDaySummary")
    @RequestMapping(value = "/queryMonthStatement",method = RequestMethod.GET)
    @ResponseBody
    public TableDataInfo queryMonthStatement(AttendanceRecordDaySummary ards) {
        logger.info("获取考勤月汇总列表 AttendanceRecordDaySummary = " + JSONObject.fromObject(ards));
        List<AttendanceRecordDaySummary> list = reportFormService.queryMonthStatement(ards);
        Long count = reportFormService.countMonthStatement(ards);
        return getDataTable(list, count);
    }

}
